import java.util.Arrays;
class Route{
    //静态成员变量
    public static double fare;
    public static double distance;
    private String name;
    private String[] stations;
    private String startStation;
    private String endStation;
    //不带参数的构造方法
    public Route() {

    }
    //带参数的构造方法
    public Route(String name, String[] stations, String startStation, String endStation) {
        this.name = name;
        this.stations = stations;
        this.startStation = startStation;
        this.endStation = endStation;
    }
    //set和get方法
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
    public String[] getStations() {
        return stations;
    }
    public void setStations(String[] stations) {
        this.stations = stations;
    }
    public String getStartStation() {
        return startStation;
    }
    public void setStartStation(String startStation) {
        this.startStation = startStation;
    }
    public String getEndStation() {
        return endStation;
    }
    public void setEndStation(String endStation) {
        this.endStation = endStation;
    }
    public void setFare(double fare) {
        this.fare = fare;
    }
    public void setDistance(double distance) {
        this.distance = distance;
    }
    //查询路线的方法
    public void queryStations() {
        System.out.println("查询的信息为:");
        System.out.println(toString());
    }

    @Override
    public String toString() {
        return "Route{" +
                "name='" + name + '\'' +
                ", stations=" + Arrays.toString(stations) +
                ", startStation='" + startStation + '\'' +
                ", endStation='" + endStation + '\'' +
                '}';
    }
}
public class Test {
    //静态成员方法
    public static void print(){
        System.out.println("欢迎下次查询");
    }
    public static void main(String[] args) {
        Route.fare=5.0;
        Route.distance=10.0;
        Route route1=new Route("101",new String[]{"S1","S2","S3","S4","S5"},"S1","S5");
        route1.queryStations();
        System.out.println("路程为："+ Route.fare+"  "+"费用为"+Route.distance);
        print();
    }
}
